package com.niit.bigdata.entity;

import java.text.SimpleDateFormat;
import java.util.Date;
public class Order {

    private String orderCategory;
    private String productName;
    private int quantity;
    private Date orderDate;
    private boolean isValid;

    // 构造方法
    public Order(String orderCategory, String productName, int quantity, Date orderDate, boolean isValid) {
        this.orderCategory = orderCategory;
        this.productName = productName;
        this.quantity = quantity;
        this.orderDate = orderDate;
        this.isValid = isValid;
    }


    public String getOrderCategory() {
        return orderCategory;
    }

    public void setOrderCategory(String orderCategory) {
        this.orderCategory = orderCategory;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public boolean isValid() {
        return isValid;
    }

    public void setValid(boolean valid) {
        isValid = valid;
    }

    public String toString() {
        SimpleDateFormat timeFormat = new SimpleDateFormat("yyyyMMdd");
        String time = timeFormat.format(this.orderDate);
        return this.orderCategory + "\t" + this.productName + "\t" + this.quantity + "\t" + time+ "\t" + (this.isValid ? "Y":"N");
    }
}
